// pages/main/me/setting/index.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    phoneNum: ""
  },


  onShow: function () {
    let _phoneNum = getApp().globalData.userInfo.phoneNumber
    _phoneNum = _phoneNum.substring(0, 3) + "****" + _phoneNum.substring(7, 11)
    this.setData({
      phoneNum: _phoneNum
    });
  },

  logout: function () {
    wx.showModal({
      title: '提示',
      content: '确定要退出登录吗？',
      showCancel: true, //是否显示取消按钮
      cancelText: "取消", //默认是“取消”
      confirmText: "确定", //默认是“确定”
      success: function (res) {
        if (res.cancel) {
          //点击取消,默认隐藏弹框
        } else {
          wx.clearStorage({
            success: (res) => {},
          });
          getApp().$routes.reLaunch(getApp().$routes.loginPage);
        }
      },
      fail: function (res) {},
      complete: function (res) {},
    })
  },

  changePhoneTap: function () {
    getApp().$routes.goTo(getApp().$routes.changePhonePage);
  }

})